/*************************************************************************************************
	Program: EACEI_SAS_DTA.sas

	This file:
		- Convert EACEI file from SAS to DTA (Stata) format

	Input: SAS FARE files in C:\Users\Public\Documents\BCG_DGM\data_deep\EACEI copied from \\casd.fr\casdfs\Projets\DETVOLT\Data\EACE_EACEI_20XX

	Output: DTA files in C:\Users\Public\Documents\BCG_DGM\data_deep\EACEI

	Comments: 
	

************************************************************************************************/

libname input "C:\Users\Public\Documents\BCG_DGM\data_deep\EACEI";


**HERE an exemple for one year
*%let year=2010;
/*
PROC EXPORT DATA= input.eacei_&year 
            OUTFILE= "C:\Users\Public\Documents\BCG_DGM\data_deep\EACEI\eacei&year" 
            DBMS=STATA REPLACE;
RUN;
*/


/*Define the macro*/
%MACRO DO_CONVERT;
%DO year = 2008 %TO 2020;
	PROC EXPORT DATA= input.eacei_&year 
	            OUTFILE= "C:\Users\Public\Documents\BCG_DGM\data_deep\EACEI\eacei&year" 
	            DBMS=STATA REPLACE;
	RUN;
%END;
%MEND DO_CONVERT;

/*Run the macro*/
%DO_CONVERT
